package com.mouse.magent.common.protocol;

import lombok.AllArgsConstructor;
import lombok.Getter;


@AllArgsConstructor
public enum Command {
    //proxy连接
    PROXY_CONNECT(1),
    //心跳
    KEEP_ALIVE(2),
    //proxy关闭
    PROXY_CLOSE(3),
    //远程服务-连接
    REMOTE_CONNECT(4),
    //远程服务-关闭
    REMOTE_DISCONNECT(5),
    //远程服务-数据
    REMOTE_DATA(6),
    ;

    @Getter
    private int code;

    public static Command valueOf(int code) {
        for (Command item : Command.values()) {
            if (item.code == code) {
                return item;
            }
        }
        throw null;
    }
}
